home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / posix / sys / stat / leak.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-18  |  341 b   |  21 lines

  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #include <unistd.h>
  4. #include <sys/stat.h>
  5.  
  6. int
  7. main(int argc, char **argv)
  8. {
  9.   int i;
  10.   struct stat s;
  11.   for (i=0; i<20; i++)
  12.   {
  13.     int fd = open("nul", O_RDONLY);
  14.     close(fd);
  15.     printf("loop %d fd %d\n", i, fd);
  16.  
  17.     stat(argc > 1 ? argv[1] : "leak.c", &s);
  18.   }
  19.   return 0;
  20. }
  21.